<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>云顶请假系统管理端</title>
    <script src="https://unpkg.com/axios/dist/axios.min.js"></script>
    <link rel="stylesheet" href="./admin_1.css">
</head>

<body>
    <div class="big_box">
        <div class="header">
            <img class="p"
                src="https://chibaoshaitaiyang-1316184616.cos.ap-beijing.myqcloud.com/%E7%99%BD%E8%89%B2%E9%80%8F%E6%98%8E%20%281%29.png"
                alt="">
        </div>
        <div class="words">
            欢迎使用<br>
            <div class="words2"><strong>云顶研学系统</strong></div>
        </div>
        <div class="section_One">
            <img src="https://chibaoshaitaiyang-1316184616.cos.ap-beijing.myqcloud.com/399cef91_E811112_03972d39.jpg"
                alt="" width="430px" height="300px">
        </div>
        <div class="main">
            <div class="title">欢迎登录</div>
            <div class="ipt">
                <div><input type="text" class="id" id="admin_id" placeholder="学号:" size="40px" style="height: 25px;">
                </div>
                <div><input type="password" id="password" placeholder="密码:" size="40px" style="height:25px;"></div>
            </div>
            <span class="many" style=" display:block;margin-left:63px; margin-top:-30px;">(8-16位)</span>
            <button class="btn">立&nbsp&nbsp&nbsp即&nbsp&nbsp&nbsp登&nbsp&nbsp&nbsp录</button>
        </div>

    </div>
    </div>
    <script src="./demo.js">
        var big_box=getElementsByClassName('big_box');
        
    </script>
  
    <script>
        var password = document.getElementById("password");
        var id = document.getElementById("admin_id");
        var many = document.getElementsByClassName("many")[0];
        password.onblur = function () {
            if (password.value.length < 8 || password.value.length > 16) {
                many.className = 'many wrong';
                many.innerHTML = '密码格式错误';
            }
            else {
                many.className = 'many right';
                many.innerHTML = '密码格式正确';
            }
        }
        var btn = document.getElementsByClassName("btn")[0];
        btn.onclick = function () {
            if (password.value.length < 8 || password.value.length > 16) {
                alert("密码格式错误")
            }
               if (id.value !== 9863364 && password.value !=='yunfeng666') {
                alert('请检查后再次登录')
                return
            }
             if (password === '' || id ==='') {
                alert('账号密码不能为空')
                return
            }
            var admin_id = document.querySelector('#admin_id').value;
            var password2 = document.querySelector('#password').value;
            axios({
                url: 'http://q2ax8vel.shenzhuo.vip:50295/admin_login/',
                method: "POST",
                headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
                data: {
                    admin_id: `${admin_id}`,
                    password: `${password2}`
                }
            })
            if (password.value.length !== 0 && id.value.length !== 0) {
                window.location.href = "../admin_2/admin_2.html"
            }
        }
    </script>
</body>

</html>